package com.zygh.dlqwservice.module.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zygh.dlqwservice.module.entity.Operation;
import com.zygh.dlqwservice.module.mapper.OperationMapper;
import com.zygh.dlqwservice.module.service.IOperationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zygh.dlqwservice.util.SendLogUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lee
 * @since 2020-12-29
 */
@Service
public class OperationServiceImpl extends ServiceImpl<OperationMapper, Operation> implements IOperationService {
    @Resource
    private OperationMapper operationMapper;

    /**
     * 定时推送日志
     * @throws Exception 异常类
     */
    @Override
    public void sendLog() throws Exception {
        List<Operation> data = operationMapper.selectList(Wrappers.<Operation>lambdaQuery().eq(Operation::getState, 1));
        for(Operation operation:data){
           // SendLogUtils.sendLog(operation);
            operation.setState(2);
        }
        this.saveOrUpdateBatch(data);
    }


}
